//
//  ReadingListTableViewCell.m
//  村医
//
//  Created by 融医网 on 2017/6/7.
//  Copyright © 2017年 融医联盟. All rights reserved.
//

#import "YCReadingListTableViewCell.h"

#define ORANGECOLOR HexColor(0xff7e00)
#define GREENCOLOR HexColor(0x4db000)

@interface YCReadingListTableViewCell()
@property (weak, nonatomic) IBOutlet UIView *lineView;



@property (weak, nonatomic) IBOutlet UILabel *timeLabel;
@property (weak, nonatomic) IBOutlet UILabel *siteName;
@property (weak, nonatomic) IBOutlet UILabel *orderStatus;
@property (weak, nonatomic) IBOutlet UILabel *auditStatus;
@property (weak, nonatomic) IBOutlet UILabel *payStatus;

@property (weak, nonatomic) IBOutlet UIView *buttonsView;


@end

@implementation YCReadingListTableViewCell

- (IBAction)toPay:(id)sender {
    self.pay();
}

- (IBAction)delateOrder:(id)sender {
    self.delataOrder();
    
}

-(void)configureWithReadingModel:(YCReadingModel *)readingModel delataOrder:(delateOrderBlock)delateOrder pay:(payBlock)pay{
    
    self.timeLabel.text = readingModel.createDate;
    self.siteName.text = readingModel.hosName;
    self.orderStatus.text = readingModel.orderStatus;
    self.payStatus.text = [NSString stringWithFormat:@"%@元",readingModel.payMoney];
    if ([self.orderStatus.text isEqualToString:@"待付款"]) {
        self.orderStatus.textColor = ORANGECOLOR;
        self.lineView.hidden = YES;
    }else if ([self.orderStatus.text isEqualToString:@"已付款"]){
        self.orderStatus.textColor = GREENCOLOR;
        self.buttonsView.hidden = YES;
        self.lineView.hidden = NO;
    }else{
        self.orderStatus.textColor = [UIColor blackColor];
        self.buttonsView.hidden = YES;
        self.lineView.hidden = NO;
    }
    self.auditStatus.text = readingModel.checkFlag;
    if ([self.auditStatus.text isEqualToString:@"待审核"]) {
        self.auditStatus.textColor = ORANGECOLOR;
    }else if ([self.auditStatus.text isEqualToString:@"已审核"]){
        self.auditStatus.textColor = GREENCOLOR;
    }
    
    self.delataOrder = delateOrder;
    self.pay = pay;
    
    
}



- (void)awakeFromNib {
    [super awakeFromNib];
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
